package com.pmcc.platform.user.web;

import com.pmcc.platform.user.entity.UserInfo;
import com.pmcc.platform.user.repository.UserInfoRepository;
import com.pmcc.platform.user.service.MessageService;
import com.pmcc.utils.ApiResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/v1/message")
public class MessageController {


    @Autowired
    MessageService messageService;

    @Autowired
    UserInfoRepository userInfoRepository;


    /**
     * 获取短信
     *
     * @param messageType 短信类型
     * @param phone       电话号码
     * @return
     */
    @RequestMapping(value = "smsValidation", method = RequestMethod.GET)
    @ResponseBody
    public ApiResultBean smsValidation(String messageType, String phone, String deviceId) {

        return messageService.smsValidation(messageType, phone, deviceId);
    }

    /**
     * 根据手机号和验证码判断  先进行手机号
     *
     * @param phone       手机号
     * @param content     验证码
     * @param messageType 短信类型
     * @return
     */
    @RequestMapping(value = "/miniShoppingCheck", method = RequestMethod.GET)
    @ResponseBody
    public ApiResultBean miniShoppingCheck(String phone, String content, String messageType,String miniUserId) {
        return messageService.miniShoppingCheck(phone, content, messageType,miniUserId);
    }

    /**
     * 根据手机号和验证码判断  先进行手机号
     *
     * @param phone       手机号
     * @param content     验证码
     * @param messageType 短信类型
     * @return
     */
    @RequestMapping(value = "/miniSalesmanCheck", method = RequestMethod.GET)
    @ResponseBody
    public ApiResultBean miniSalesmanCheck(String phone, String content, String messageType,String minSalesamnUserId) {
        return messageService.miniSalesmanCheck(phone, content, messageType,minSalesamnUserId);
    }


}
